<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Execute a string as Javascript code</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="v8js.construct.html">« V8Js::__construct</a></li>
      <li style="float: right;"><a href="v8js.getextensions.html">V8Js::getExtensions »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.v8js.html">V8Js</a></li>
    <li>Execute a string as Javascript code</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="v8js.executestring" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">V8Js::executeString</h1>
  <p class="verinfo">(PECL v8js &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">V8Js::executeString</span> &mdash; <span class="dc-title">Execute a string as Javascript code</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-v8js.executestring-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>V8Js::executeString</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$script</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$identifier</code><span class="initializer"> = &quot;V8Js::executeString()&quot;</span></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = <strong><code>V8Js::FLAG_NONE</code></strong></span></span>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>

  <p class="para rdfs-comment">
   Compiles and executes the string passed with <code class="parameter">script</code> as Javascript code.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-v8js.executestring-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">script</code></dt>

    <dd>

     <p class="para">
      The code string to be executed.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">identifier</code></dt>

    <dd>

     <p class="para">
      Identifier string for the executed code. Used for debugging.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">flags</code></dt>

    <dd>

     <p class="para">
      Execution flags. This value must be one of the
      <code class="literal">V8Js::FLAG_*</code> constants, defaulting to
      <strong><code>V8Js::FLAG_NONE</code></strong>.
      <ul class="itemizedlist">
        <li class="listitem">
         <p class="para">
          <strong><code>V8Js::FLAG_NONE</code></strong>: no flags
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code>V8Js::FLAG_FORCE_ARRAY</code></strong>: forces all Javascript
          objects passed to PHP to be associative arrays
         </p>
        </li>
      </ul>
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-v8js.executestring-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the last variable instantiated in the Javascript code converted to matching PHP variable type.
  </p>
 </div>

</div></div></div></body></html>